﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Web.Configuration;
using System.Configuration;


namespace JCW.Common
{

    public static class WebConfig
    {
        //属性

        #region 默认数据库连接字符串
        /// <summary>
        /// 默认数据库连接字符串
        /// </summary>
        public static string DefaultConnectionString
        {
            get
            {
                return GetConnectionString("Default");
            }
        }
        #endregion

        //方法

        #region 数据库连接字符串
        /// <summary>
        /// 数据库连接字符串
        /// </summary>
        public static string GetConnectionString(string name)
        {
            return ConvertHelper.ToString(ConfigurationManager.ConnectionStrings[name].ConnectionString);
        }
        #endregion

        #region 取得配置串
        /// <summary>
        /// 取得配置串
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public static string GetAppSetting(string name)
        {
            return ConvertHelper.ToString(ConfigurationManager.AppSettings[name]);
        }
        #endregion
    }
}